package com.ld.security.shop.crawler.modules.re.crawler.hy;

import com.ld.security.shop.crawler.modules.re.constant.CrawlerConstant;
import com.ld.security.shop.crawler.modules.re.crawler.BaseCrawler;
import com.ld.security.shop.crawler.modules.re.entity.ReDetails;
import com.ld.security.shop.crawler.modules.re.service.IReBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class HyReDetailsCrawler extends BaseCrawler<ReDetails> {

    @Autowired
    IReBookService iReBookService;

    public HyReDetailsCrawler() {
        super( CrawlerConstant.projectCode.edd,false);
    }

    @Override
    public ReDetails dataCrawler(String url) {
        ReDetails reDetails = super.dataCrawler(url);
        iReDetailsService.save(reDetails);
//        Document document =  this.parse(reDetails.getContent());
//        Element content =  document.select(".product_main ").first();
//        reDetails.setContent(content.outerHtml());
        return reDetails;
    }


    public void parsing(String id) {
        ReDetails reDetails = iReDetailsService.getById(id);
        parsing(reDetails);
    }


}

